import json
from sse_starlette import ServerSentEvent
async def decorate(generator):
    async for item in generator:
        yield ServerSentEvent(json.dumps(item, ensure_ascii=False), event="message")